//
//  EarningsDetailView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/13.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "EarningsDetailView.h"
#import <Masonry.h>
@implementation EarningsDetailView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    self.backgroundColor = [UIColor colorWithRed:242 / 255.0 green:244 / 255.0 blue:246 / 255.0 alpha:1];
    
    self.topView = [[UIView alloc] init];
    UIImage *image = [UIImage imageNamed:@"shouyi_bg"];
    self.topView.layer.contents = (id)image.CGImage;
    [self addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.height.mas_equalTo(230);
    }];
    
    self.bottomView = [[UIView alloc] init];
    UIImage *image1 = [UIImage imageNamed:@"shouyi_bg1"];
    self.bottomView.layer.contents = (id)image1.CGImage;
    [self addSubview:self.bottomView];
    [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.equalTo(self.topView.mas_bottom);
        make.bottom.equalTo(self);;
    }];
    
    self.totalEarnLab = [[UILabel alloc] init];
    self.totalEarnLab.text = @"总收益(元)";
    self.totalEarnLab.font = [UIFont systemFontOfSize:16];
    self.totalEarnLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    [self.topView addSubview:self.totalEarnLab];
    [self.totalEarnLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.mas_equalTo(30);
    }];
    
    self.totalEarnLeftLineView = [[UIView alloc] init];
    self.totalEarnLeftLineView.backgroundColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    [self.topView addSubview:self.totalEarnLeftLineView];
    [self.totalEarnLeftLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.totalEarnLab.mas_left).offset(-2);
        make.centerY.equalTo(self.totalEarnLab);
        make.width.mas_equalTo(18);
        make.height.mas_equalTo(1);
    }];
    
    self.totalEarnRightLineView = [[UIView alloc] init];
    self.totalEarnRightLineView.backgroundColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    [self.topView addSubview:self.totalEarnRightLineView];
    [self.totalEarnRightLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.totalEarnLab.mas_right).offset(2);
        make.centerY.equalTo(self.totalEarnLab);
        make.width.mas_equalTo(18);
        make.height.mas_equalTo(1);
    }];
    
    self.totalEarnValueLab = [[UILabel alloc] init];
    self.totalEarnValueLab.text = [NSString stringWithFormat:@"%@%@",@"￥",@""];
    self.totalEarnValueLab.font = [UIFont systemFontOfSize:36];
    self.totalEarnValueLab.textColor = [UIColor colorWithRed:252 / 255.0 green:92 / 255.0 blue:76 / 255.0 alpha:1];
    [self.topView addSubview:self.totalEarnValueLab];
    [self.totalEarnValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.totalEarnLab.mas_bottom).offset(10);
    }];
    
    self.ableWithdrawNumLab = [[UILabel alloc] init];
    self.ableWithdrawNumLab.text = [NSString stringWithFormat:@"%@%@",@"账账户可提现余额: ￥",@""];
    self.ableWithdrawNumLab.font = [UIFont systemFontOfSize:14];
    self.ableWithdrawNumLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    [self.topView addSubview:self.ableWithdrawNumLab];
    [self.ableWithdrawNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.totalEarnValueLab.mas_bottom).offset(17);
    }];
    
    self.withdrawBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.withdrawBtn.backgroundColor = [UIColor colorWithRed:91 / 255.0 green:113 / 255.0 blue:255 / 255.0 alpha:1];
    [self.withdrawBtn setTitle:@"马上提现" forState:(UIControlStateNormal)];
    [self.withdrawBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.withdrawBtn.layer.cornerRadius = 22;
    [self.topView addSubview:self.withdrawBtn];
    [self.withdrawBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(44);
        make.bottom.mas_equalTo(-26);
        make.left.mas_equalTo(52);
        make.right.mas_equalTo(-52);
    }];
    
    self.amountDetailLab = [[UILabel alloc] init];
    self.amountDetailLab.text = @"账户明细";
    self.amountDetailLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    self.amountDetailLab.font = [UIFont systemFontOfSize:14];
    [self.bottomView addSubview:self.amountDetailLab];
    [self.amountDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(10);
    }];
    
    self.selectImv = [[UIImageView alloc] init];
    self.selectImv.image = [UIImage imageNamed:@"icon_arrow_down"];
    [self.bottomView addSubview:self.selectImv];
    [self.selectImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.equalTo(self.amountDetailLab);
        make.width.mas_equalTo(16);
        make.height.mas_equalTo(16);
    }];
    
    self.selectbtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.selectbtn setTitle:@"筛选" forState:(UIControlStateNormal)];
    [self.selectbtn setTitleColor:[UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    [self.selectbtn setTitleColor:[UIColor colorWithRed:91 / 255.0 green:113 / 255.0 blue:255 / 255.0 alpha:1] forState:(UIControlStateSelected)];
    self.selectbtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.bottomView addSubview:self.selectbtn];
    [self.selectbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.selectImv.mas_left);
        make.centerY.equalTo(self.selectImv);
    }];
    
    self.lineView = [[UIView alloc] init];
    self.lineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 / 255.0 blue:229 / 255.0 alpha:1];
    [self.bottomView addSubview:self.lineView];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.amountDetailLab);
        make.right.equalTo(self.selectImv);
        make.top.equalTo(self.amountDetailLab.mas_bottom).offset(15);
        make.height.mas_equalTo(1);
    }];
    
    
    self.bottomShowView = [[UIView alloc] init];
    self.bottomShowView.backgroundColor = [UIColor whiteColor];
    self.bottomShowView.layer.cornerRadius = 5;
    [self.bottomView addSubview:self.bottomShowView];
    [self.bottomShowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.equalTo(self.lineView.mas_bottom);
        make.bottom.equalTo(self.bottomView);
    }];
    
    self.wushujuImv = [[UIImageView alloc] init];
    self.wushujuImv.image = [UIImage imageNamed:@"image-wushuju"];
    [self.bottomShowView addSubview:self.wushujuImv];
    [self.wushujuImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(150);
        make.centerY.equalTo(self.bottomShowView).offset(-20);
        make.centerX.equalTo(self.bottomShowView);
    }];
    
    self.wushujuLab = [[UILabel alloc] init];
    self.wushujuLab.text = @"暂时没有数据哦~";
    self.wushujuLab.textColor = ETColorWithRGB(153, 153, 153);
    self.wushujuLab.font = [UIFont systemFontOfSize:14];
    [self.bottomShowView addSubview:self.wushujuLab];
    [self.wushujuLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.wushujuImv);
        make.top.equalTo(self.wushujuImv.mas_bottom).offset(5);
    }];
    
    
}

@end
